﻿<?php
	
	
	
	
	function send_mail($to, $subject = '(No subject)', $message = '')
	{ 
		require 'PHPMailer/PHPMailerAutoload.php';
		//$to = "sw3nn3@gmail.com"; //KOMMENTERA BORT DENNA  ELLER ÄNDRA
		$from_user = "Sales Makeover Admin";
		$from_email = "info@twentyfiveentertainment.com";
		
		$mail = new PHPMailer;

		$mail->isSMTP();                                      // Set mailer to use SMTP

		/*$mail->Host = 'smtp.gmail.com';  // Specify main and backup server
		$mail->Port = 465;  // Specify main and backup server
		$mail->SMTPAuth = true;                               // Enable SMTP authentication
		$mail->Username = 'sw3nn3@gmail.com';                            // SMTP username
		$mail->Password = 'panamakanalen';                           // SMTP password
		$mail->SMTPSecure = 'ssl';                            // Enable encryption, 'ssl' also accepted*/

		$mail->Host = 'mail.twentyfiveentertainment.com';  // Specify main and backup server
		$mail->Port = 587;  // Specify main and backup server
		$mail->SMTPAuth = true;                               // Enable SMTP authentication
		$mail->Username = 'info@twentyfiveentertainment.com';                            // SMTP username
		$mail->Password = 'intlol=25';                           // SMTP password
		$mail->SMTPSecure = 'tls';                            // Enable encryption, 'ssl' also accepted

		$mail->From = $from_email;
		$mail->FromName = $from_user;
		//$mail->addAddress('josh@example.net', 'Josh Adams');  // Add a recipient
		$mail->addAddress($to);               // Name is optional
		//$mail->addReplyTo('info@example.com', 'Information');
		//$mail->addCC('cc@example.com');
		//$mail->addBCC('bcc@example.com');

		$mail->WordWrap = 50;                                 // Set word wrap to 50 characters
		//$mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
		//$mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
		$mail->IsHTML(true);                                  // Set email format to HTML
		$mail->CharSet = 'UTF-8';
		$mail->Subject = $subject;
		$mail->Body    = $message;
		//$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

		if(!$mail->send()) {
		   //echo 'Message could not be sent.';
		   //echo 'Mailer Error: ' . $mail->ErrorInfo;
		   exit;
		}

		//echo 'Message has been sent';
	}
	
	function sendNewUserEmail($to, $newUser, $newUserCompany)
	{
		$subject = 'Sales Makeover - Ny användare';
		
		$message = '
		<html>
		<head>
		  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		  <title>'.$subject.'</title>
		</head>
		<body>
		  En ny användare har lagts till i '.$newUserCompany.'.
		  <br/>
		  '.$newUser.'
		</body>
		</html>
		';
		
		send_mail($to, $subject, $message);
	}
	
	function sendNewManagerEmail($to, $newManager, $newManagerCompany)
	{
		$subject = 'Sales Makeover - Ny manager';
		
		$message = '
		<html>
		<head>
		  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		  <title>'.$subject.'</title>
		</head>
		<body>
		  En ny manager har lagts till i '.$newManagerCompany.'.
		  <br/>
		  '.$newManager.'
		</body>
		</html>
		';
		
		send_mail($to, $subject, $message);
	}
	
	function sendNewCompanyEmail($to, $newCompany, $newManager)
	{
		$subject = 'Sales Makeover - Nytt företag';
		
		$message = '
		<html>
		<head>
		  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		  <title>'.$subject.'</title>
		</head>
		<body>
		  Ett nytt företag har lagts till i systemet tillsammans med en ny manager.
		  <br/>
		  '.$newCompany.'
		  <br/>
		  '.$newManager.'
		</body>
		</html>
		';
		
		send_mail($to, $subject, $message);
	}
	
	function sendAccountInfo($to, $usersname, $key,$id)
	{
  
  
  if($id==2)
		$hostURL = "http://m.leadsmachine.se";
	else
     $hostURL = "http://leadsmachine.se";
		
    $subject = 'Sales Makeover - Kontoinformation';
		
		$message = '  
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta name="viewport" content="width=device-width" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Login Mail</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
            font-size: 100%;
            line-height: 1.6;
        }
        .button {
            font-size: 14px;
            background-color: #ce3690;
            text-align: center;
            cursor: pointer;
            color: white;
            border-radius: 3px;
            border: none!important;
            padding: 50px;
            padding-top: 10px;
            padding-bottom: 10px;
        }
            .button:hover {
                background-color: #a33481;
            }

            .button:active {
                background-color: #7a2d66;
            }

        .noDecoration, a:link, a:visited {
            text-decoration: none;
        }
    </style>
</head>
<body bgcolor="#f6f6f6">
    <table style="margin: 30px;">
        <tr>
            <td>
                <img src="http://twentyfiveentertainment.com/Apps/Sales%20MakeOver%20Mobile/content/salesmakeover_logo.png">
            </td>
        </tr>
        <tr>
            <td style="font-size: 17px; margin-left: 30px; margin-right: 30px; padding-top: 10px; margin-bottom: 30px" align="left">Hej ' . $usersname . '!</td>
        </tr>
        <tr>
            <td style="font-size: 12px; margin-left: 30px; margin-right: 30px; margin-top: 10px; margin-bottom: 30px" align="left">
                Din mail har blivit registerad i ett konto på Sales Makeover.för att komma igång med ditt konto behöver du aktivera och välja lösenord, vilket du gör via knappen nedan
            </td>
        </tr>
        <tr>
            <td style="padding-top: 30px; font-size: 12px; margin-left: 30px; margin-right: 30px; margin-top: 10px; margin-bottom: 30px" align="left">
                <center>
                    <a href="'.$hostURL.'/reset.php?key=' . $key . '"><span class="button noDecoration">Activera</span></a>
            </td>
        </tr>
        <tr>
            <td style="font-size: 12px; margin: 30px; padding-top: 30px; color: GrayText;">
                <center>
                info@salesmakeover.se | +46(0)8651 25 00
            </td>
        </tr>
    </table>
</body>
</html>
		';
		
		send_mail($to, $subject, $message);
	}
	
	function sendNewAccountInfo($to, $usersname, $key, $id)
	{
		if($id==2)
			$hostURL = "http://m.leadsmachine.se";
		else
			$hostURL = "http://leadsmachine.se";
	
		$subject = 'Sales Makeover - Kontoinformation';
		
		$message = '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta name="viewport" content="width=device-width" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Really Simple HTML Email Template</title>
    <style>
        /* -------------------------------------
		GLOBAL
------------------------------------- */
        * {
            margin: 0;
            padding: 0;
            font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
            font-size: 100%;
            line-height: 1.6;
        }

        img {
            max-width: 100%;
        }

        body {
            -webkit-font-smoothing: antialiased;
            -webkit-text-size-adjust: none;
            width: 100%;
            
            height: 100%;
        }

        .button
{
            
	font-size:14px; 
    background-color: #ce3690;

	text-align:center;
	cursor: pointer;
    color:white;
    border-radius: 3px;
    border:none!important;
    padding:50px;
    padding-top:10px;
    padding-bottom:10px;

    
}
.button:hover
{
    background-color:#a33481;
}
.button:active
{
    background-color:#7a2d66;
}
.noDecoration, a:link, a:visited {
    text-decoration: none;
}
    </style>
</head>

<body bgcolor="#f6f6f6">

    <div align="left" style="margin: 30px; width:200px;">

        <img src="http://m.leadsmachine.se/content/salesmakeover_logo.png">
    </div>
     <div style="font-size: 17px; font:bold; margin-left: 30px;" align="left">
      Hej ' . $usersname . '!

        </div>
    <div style="font-size: 12px; margin-left: 30px;margin-right: 30px ; margin-top:10px; margin-bottom:30px" align="left">
          Ditt lösenord har blivit återställt hos Sales Makeover. Välj nytt lösenord via knappen nedan.
		
        </div>

    <center>
    <a href="'.$hostURL.'/reset.php?key=' . $key . '"><span class="button noDecoration">Återställ lösenord</span></a>
        
    <div style="font-size: 12px; margin: 30px; color:GrayText;">
       info@salesmakeover.se | +46(0)8651 25 00
         
         		
    </div>
    </center>

    <!-- /body -->


</body>
</html>


		';
		
		send_mail($to, $subject, $message);
	}
	
	function sendNewInnovation($to, $ManagerName, $InnovationName, $InnovationOwnerName, $CustomerName, $Created, $Recommendation, $Problem, $Solution, $CustomerValue, $NextStep, $TimeFrame)
	{
		$hostURL = "http://leadsmachine.se";
	
		$subject = 'Sales Makeover - Ny Innovation';
		
		$message = '
		<html>
		<head>
		  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		  <title>'.$subject.'</title>
		</head>
		<body>
		  Hej ' . $ManagerName . '!<br/>
		  En ny rekommendation har lagts till. Du kan läsa den här: 
		</body>
		</html>
		';
		
		send_mail($to, $subject, $message);


	}
	
	
?>